/**
 * 2024/05/21
 * ssyyw
 * mavproxy_ros1的飞行任务处理节点
 *
 */

#ifndef FLIGHT_HANDLER
#define FLIGHT_HANDLER

#include <string>
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <std_msgs/Int32.h>
#include "drone_defs.h"

class FlightHandler{
public:
    FlightHandler();

    void Run();
    mavproxy_ros1::FlightCmd GetFlightCmd(const std::string &str);

private:
    void CmdCallback(const std_msgs::String::ConstPtr &msg);
    void StateCallback(const mavproxy_ros1::FlightState::ConstPtr &msg);

    ros::ServiceClient controllClient;

    mavproxy_ros1::FlightCmd cmd;
    mavproxy_ros1::FlightState state;

    ros::Subscriber inputCmdSub;
    ros::Subscriber flightStateSub;
    ros::Publisher parsedCmdPub;

    ros::NodeHandle nh;
};

#endif